CC=gcc
CFLAGS=-Wall -ggdb -std=c99 -pedantic-errors -D_GNU_SOURCE
GCFLAGS=`pkg-config --cflags glib-2.0`
GLIBS=`pkg-config --libs glib-2.0`
XMLLIBS=`pkg-config --libs libxml-2.0`
XMLCFLAGS=`pkg-config --cflags libxml-2.0`
LIBTYPES_DIR=../../../../c/types/
LIBPARSER_DIR=../../../../c/parser/
LIBS=-lm -L$(LIBTYPES_DIR) -ltypes -L$(LIBPARSER_DIR) -lparser

%.o: %.c
	$(CC) -c -fPIC $(CFLAGS) $(GCFLAGS) $(XMLCFLAGS) $< -o $@

parser: parser.o main.c
	$(CC) $(CFLAGS) $(LIBS) $(GLIBS) $(GCFLAGS) $(XMLLIBS) main.c -o $@

clean:
	rm -f *.o parser
	
run: parser
	./parser

test: parser
	@LD_LIBRARY_PATH=$(LIBTYPES_DIR):$(LIBPARSER_DIR) \
	gdb --batch -ex ru -ex bt --args parser ../../samples/ios1.txt
